package cn.restcloud.example.ssofilter;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

//打开以下配置增加sso的过滤器
//@EnableAutoConfiguration
//@Configuration
public class SSOFiltersConfig extends WebMvcConfigurationSupport{
	
    @Bean  
    public FilterRegistrationBean ssoFilterRegistration() {
	   //gypj cas单点登录过滤器
    	System.out.println("启动SSO登录过滤器组件 ................");
        FilterRegistrationBean registration = new FilterRegistrationBean();  
        registration.setFilter(new SSOLoginFilter());  
        registration.addUrlPatterns("/restcloud/*");
        registration.addInitParameter("url", "http://192.168.1.1/cas/login");
        registration.setName("SSO Filter");
        registration.setOrder(-1);
        return registration;
    }
    
}
